﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Rotempco.Website.UserControls
{
    public partial class MenuAdministrator : System.Web.UI.UserControl
    {
        public bool Showmenu { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Url.AbsolutePath.ToLower().Contains("/admin/chosenlanguages/")
                || Request.Url.AbsolutePath.ToLower().Contains("/admin/departments/"))
            {
                placeHolder_AdministratorSiteSetup.Visible = true;
                menu_1.CssClass = "menuSelected";
            }
            
            if (Request.Url.AbsolutePath.ToLower().Contains("/admin/users/")
                  || Request.Url.AbsolutePath.ToLower().Contains("/admin/changepasswordqueues/"))
            {
                placeHolder_UserSettings.Visible = true;
                menu_3.CssClass = "menuSelected";
            }

            if (Request.Url.AbsolutePath.ToLower().Contains("/admin/passwordsettings/")
                || Request.Url.AbsolutePath.ToLower().Contains("/admin/dataretention/")
                || Request.Url.AbsolutePath.ToLower().Contains("/admin/blockips/")
                )
            {
                placeHolder_SecuritySettings.Visible = true;
                menu_4.CssClass = "menuSelected";
            }

            if (Request.Url.AbsolutePath.ToLower().Contains("/admin/auditlogs/"))
                menu_5.CssClass = "menuSelectedNoSubmenu";

            if (Request.Url.AbsolutePath.ToLower().Contains("/admin/issuefields/")
                || Request.Url.AbsolutePath.ToLower().Contains("/admin/pagetexts/")
                || Request.Url.AbsolutePath.ToLower().Contains("/admin/issuedesigner/"))
            {
                placeHolder_AdministratorIssueSetup.Visible = true;
                menu_2.CssClass = "menuSelected";
            }
                        

            if (Request.Url.AbsolutePath.ToLower().Contains("/admin/chosenlanguages/"))
                subMenu_1.CssClass = "menuSelectedNoSubmenu";
            else if (Request.Url.AbsolutePath.ToLower().Contains("/admin/departments/"))
                subMenu_2.CssClass = "menuSelectedNoSubmenu";
            else if (Request.Url.AbsolutePath.ToLower().Contains("/admin/pagetexts/"))
                subMenu_3.CssClass = "menuSelectedNoSubmenu";
            else if (Request.Url.AbsolutePath.ToLower().Contains("/admin/issuefields/"))
                subMenu_4.CssClass = "menuSelectedNoSubmenu";
            else if (Request.Url.AbsolutePath.ToLower().Contains("/admin/issuedesigner/"))
                subMenu_5.CssClass = "menuSelectedNoSubmenu";
            else if (Request.Url.AbsolutePath.ToLower().Contains("/admin/passwordsettings/"))
                subMenu_8.CssClass = "menuSelectedNoSubmenu";
            else if (Request.Url.AbsolutePath.ToLower().Contains("/admin/blockips/"))
                subMenu_9.CssClass = "menuSelectedNoSubmenu";
            else if (Request.Url.AbsolutePath.ToLower().Contains("/admin/users/"))
                subMenu_6.CssClass = "menuSelectedNoSubmenu";
            else if (Request.Url.AbsolutePath.ToLower().Contains("/admin/changepasswordqueues/"))
                subMenu_7.CssClass = "menuSelectedNoSubmenu";
            else if (Request.Url.AbsolutePath.ToLower().Contains("/admin/dataretention/"))
                subMenu_DataRetention.CssClass = "menuSelectedNoSubmenu";
        }
    }
}